package com.paschino.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.paschino.dao.ProductDAO;
import com.paschino.modal.Category;
import com.paschino.modal.Product;

@Service
@Transactional
public class ProductServiceImpl implements ProductService {

	@Autowired
	private ProductDAO productDAO;

	@Override
	public boolean addProduct(Product product) {
		return productDAO.addProduct(product);
	}

	@Override
	public List<Product> getProductList() {
		return productDAO.getProductList();
	}

	@Override
	public Product getProduct(int productId) {
		return productDAO.getProduct(productId);
	}

	@Override
	public boolean updateProduct(Product product) {
		return productDAO.updateProduct(product);
	}

	@Override
	public List<Product> getProductList(int page, int resultPerPage) {
		return productDAO.getProductList(page, resultPerPage);
	}
	
	@Override
	public List<Product> getProductListByCate(Category cate){
		return productDAO.getProductListByCate(cate);
	}
	
	@Override
	public int deleteProduct(int productID){
		return productDAO.deleteProduct(productID);
	}
	
	@Override
	public List<Product> getProductListByCateAndIsActive(Category cate){
		return productDAO.getProductListByCate(cate);
	}
		
	@Override
	public int hideProduct(int productID){
		return productDAO.hideProduct(productID);
	}
	
	@Override
	public int unhideProduct(int productID){
		return productDAO.unhideProduct(productID);
	}
}
